package com.lecture.java8.excel.dyr.e;

import com.alibaba.excel.EasyExcel;
import com.lecture.java8.excel.DemoDataListener;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Test0529 {
    public static void main(String[] args) {
        String dir = "D:\\study\\tmp\\0529\\";


        String result1 = dir + "1_content_1711696837103.xlsx";
        DemoDataListener<Model0529> dataResultListener = new DemoDataListener<>();
        EasyExcel.read(result1, Model0529.class,dataResultListener).sheet().doRead();
        List<Model0529> resultList = dataResultListener.getDataList();
        Map<String,Model0529> map1 = new HashMap<>();
        for (Model0529 result : resultList) {
            String key = result.getA() + "-" + result.getB();
            map1.put(key,result);
        }



        String dataResultFileName = dir + "显著性0.004的(1).xlsx";
        DemoDataListener<Result0529> dataListener = new DemoDataListener<>();
        EasyExcel.read(dataResultFileName, Result0529.class,dataListener).sheet().doRead();
        List<Result0529> dataList = dataListener.getDataList();

        for (Result0529 model : dataList) {
            String key = model.getA() + "-" + model.getB();
            Model0529 model0529 = map1.get(key);
            if (model0529 != null) {
                model.setAo(model0529.getC());
            }

        }

        EasyExcel.write(dir + "result2.xlsx", Result0529.class)
                .sheet("a").doWrite(dataList);
    }
}
